<template>
   <div class='space-y-1 rounded-lg border border-gray-200 bg-white p-1 shadow-lg' :style="{width: itemWidth || 228,}">
           <Empty description="当前选择的操作没有可用的变量进行赋值"
              title="没有可用变量" v-if="(!vars || vars.length === 0) && popupFor === 'toAssigned'"
            >
          </Empty>
            <Empty  description=" 赋值变量必须是可写入的变量" v-if="(!vars || vars.length === 0) && popupFor !== 'toAssigned'"
              title="没有可用的赋值变量"
            >
          </Empty>
         <VarReferenceVars v-if="vars && vars.length > 0"
          searchBoxClassName='mt-1'
          :vars="vars"
          @change="onChange"
          :itemWidth="itemWidth"
          :isSupportFileVar="isSupportFileVar"
        />
    </div >
</template>
<script setup lang="ts" name="VarReferencePopup">
import VarReferenceVars from './var-reference-vars.vue'
import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import {Empty} from 'ant-design-vue'


type Props = {
  vars: NodeOutPutVar[]
  popupFor?: 'assigned' | 'toAssigned'
  onChange: (value: ValueSelector, varDetail: Var) => void
  itemWidth?: number
  isSupportFileVar?: boolean
}
withDefaults(defineProps<Props>(),{
  isSupportFileVar:()=> true
})
</script>

